<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>工会管理- <{$columnname}></title>
        <meta name="keywords" content="">
        <meta name="description" content="">
        <link rel="shortcut icon" href="../favicon.ico">
        <link href="__PUBLIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
        <link href="__PUBLIC__/css/font-awesome.css?v=4.4.0" rel="stylesheet">
        <link href="__PUBLIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
        <link href="__PUBLIC__/css/animate.css" rel="stylesheet">
        <link href="__PUBLIC__/css/style.css?v=4.1.0" rel="stylesheet">
        <link rel="stylesheet" href="__PUBLIC__/css/liandong.css"/>
        <link href="__PUBLIC__/Widget/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
        <script src="__PUBLIC__/js/plugins/layer/laydate/laydate.js"></script>
    </head>
    <body class="gray-bg">
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>工会管理- <small><{$columnname}></small>
                            </h5>
                        </div>
                        <div class="ibox-content">
                            <form method="post" class="form-horizontal" onsubmit="return false">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">*工会名称</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" value="<{$data.name}>" placeholder="请输入工会名称" id="txtname">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">*工会等级</label>
                                    <div class="col-sm-10">
                                        <select class="form-control" id="ddlgrade">
                                            <option value="0">-请选择工会等级-</option>
                                            <volist name="data_labor_grade" id="vo">
                                                <option value="<{$vo.value}>" <{$vo.selected}>><{$vo.text}></option>
                                            </volist>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">*所在地区</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" value="<{$data.address}>" placeholder="请输入所在地区" id="txtaddress">
                                    </div>
                                </div>
				<div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">*联系人</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" value="<{$data.linkman}>" placeholder="请输入联系人" id="txtlinkman">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">*手机号码/登录账号</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" value="<{$data.tel}>" placeholder="请输入手机号码" id="txttel">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">*登录密码</label>
                                    <div class="col-sm-10">
                                        <input type="password" class="form-control" value="" placeholder="请输入登录密码，为空表示123456" id="txtpwd">
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <button class="btn btn-primary" type="button" onclick="add_submit(this)"><{$btnname}></button>&nbsp;&nbsp;&nbsp;
                                        <button class="btn btn-white" type="reset">重置</button>
                                    </div>
                                </div>
                            </form>

                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--  全局js -->
        <script src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script>
        <script src="__PUBLIC__/js/bootstrap.min.js?v=3.3.6"></script>
        <!-- 自定义js -->
        <script src="__PUBLIC__/js/content.js?v=1.0.0"></script>
        <script src="__PUBLIC__/js/plugins/layer/layer.min.js"></script>
        <script src="__PUBLIC__/js/liandong.js"></script> 
        <script type="text/javascript" src="__PUBLIC__/Widget/webuploader/0.1.5/webuploader.min.js"></script>
        <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
        <!-- iCheck -->
        <script src="__PUBLIC__/js/plugins/iCheck/icheck.min.js"></script>
        <script>
                                            $(document).ready(function () {
                                                $('.i-checks').iCheck({
                                                    checkboxClass: 'icheckbox_square-green',
                                                    radioClass: 'iradio_square-green',
                                                });
                                            });
        </script>
        <script>
            var labname = "<{$btnname}>";
            var laboraddsubmit = "<{:U('laboradd','','shtml')}>";
            var laborlist = "<{:U('laborlist','','shtml')}>";
            var app_code = "<{$app_code}>";
            function add_submit(obj) {
                var $obj = $(obj);
                var $txtname = $('#txtname');
                var $txtaddress = $('#txtaddress');
                var $ddlgrade = $('#ddlgrade');
                var $txtlinkman = $('#txtlinkman');
                var $txttel = $('#txttel');
                var $txtpwd = $('#txtpwd');
                var id = "<{$id}>";
                var name = $txtname.val();
                var address = $txtaddress.val();
                var gradeid = $ddlgrade.val();
                var linkman = $txtlinkman.val();
                var tel = $txttel.val();
                var pwd = $txtpwd.val();
                if (name == "") {
                    layer.alert('工会名称不能为空！\r\n', {title: '提示框', icon: 0});
                    return false;
                }
                if (!(gradeid > 0)) {
                    layer.alert('工会等级不能为空！\r\n', {title: '提示框', icon: 0});
                    return false;
                }
                if (address == "") {
                    layer.alert('所在地区不能为空！\r\n', {title: '提示框', icon: 0});
                    return false;
                }
                if (linkman == "") {
                    layer.alert('联系人不能为空！\r\n', {title: '提示框', icon: 0});
                    return false;
                }
                if (tel != "" && !(/^1[34578]{1}\d{9}$/.test(tel))) {
                    layer.alert('手机号码格式不正确！\r\n', {title: '提示框', icon: 0});
                    return false;
                }
//		$obj.html(labname + '中…').removeClass('btn-primary').unbind('click').removeAttr('onclick');
                layer.confirm('确定<{$btnname}>该工会吗？', function (index) {
                    layer.close(index);
                    //加载loading层
                    var loading = layer.load(1, {
                        shade: [0.1, '#fff'] //0.1透明度的白色背景
                    });
                    $.post(laboraddsubmit, {'id': id, 'name': name, 'gradeid': gradeid, 'address': address, 'linkman': linkman, 'tel': tel, 'pwd': pwd,'app_code':app_code},
                            function (data) {
                                if (data.ret == '1001') {
                                    layer.close(loading);
                                    layer.msg(data.code, {icon: 6, time: 1000});
                                    setTimeout(function () {
                                        window.location.href = laborlist;
                                    }, 1000);
                                } else {
                                    layer.close(loading);
                                    layer.msg(data.code, {icon: 5, time: 1000});
                                    $obj.html(labname).addClass('btn-primary').attr('onclick', 'add_submit(this)');
                                }
                            }, 'json');
                });
            }

        </script>
    </body>
</html>
